﻿<controls:MetroContentControl x:Class="Wix.Win8SetupBootstrapper.Views.FeaturesPageView"
                              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                              xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                              xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
                              xmlns:viewModels="clr-namespace:Wix.Win8SetupBootstrapper.ViewModels"
                              mc:Ignorable="d"
                              d:DesignHeight="300" d:DesignWidth="450"
                              d:DataContext="{d:DesignInstance viewModels:FeaturesPageViewModel }">
    <controls:MetroContentControl.Resources>
        <ResourceDictionary>
           
            <SolidColorBrush x:Key="AccentColorBrush2" Color="Transparent" />
            
            <Style TargetType="{x:Type TreeViewItem}" BasedOn="{StaticResource MetroTreeViewItem}" />
            <Style TargetType="{x:Type TreeView}" BasedOn="{StaticResource MetroTreeView}" />

            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary
                    Source="pack://application:,,,/MahApps.Metro;component/Styles/controls.treeview.xaml" />
                <ResourceDictionary
                    Source="pack://application:,,,/MahApps.Metro;component/Styles/controls.checkbox.xaml" />
            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>
    </controls:MetroContentControl.Resources>
    <DockPanel Margin="10,0,0,0" LastChildFill="True">
        <TextBlock Text="Select Features to install" DockPanel.Dock="Top" FontSize="16" />
        <TreeView ItemsSource="{Binding PackagesList}" Style="{StaticResource MetroTreeView}">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate DataType="viewModels:PackageItemViewModel"
                                          ItemsSource="{Binding FeaturesList}">
                    <CheckBox Style="{StaticResource MetroCheckBox}" Content="{Binding DisplayName}"
                              IsChecked="{Binding IsSelected}" />
                    <HierarchicalDataTemplate.ItemTemplate>
                        <DataTemplate DataType="viewModels:FeatureItemViewModel">
                            <Grid>
                                <Grid.Resources>
                                    <Style TargetType="{x:Type TextBlock}">
                                        <Setter Property="Foreground" Value="Black" />
                                    </Style>
                                </Grid.Resources>
                                <Grid.RowDefinitions>
                                    <RowDefinition />
                                    <RowDefinition />
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition />
                                    <ColumnDefinition />
                                </Grid.ColumnDefinitions>
                                <CheckBox Grid.Column="0" Grid.Row="0" Grid.RowSpan="2"
                                          IsChecked="{Binding IsSelected}" />
                                <TextBlock Grid.Column="1" Grid.Row="0" Text="{Binding Caption}" />
                                <TextBlock Grid.Column="1" Grid.Row="1" Text="{Binding DescriptionWithSize}" />
                            </Grid>
                        </DataTemplate>
                    </HierarchicalDataTemplate.ItemTemplate>

                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
    </DockPanel>
</controls:MetroContentControl>